{include file="pageheader_erp.htm"}

<link href="styles/erp_payment.css" rel="stylesheet" type="text/css" />
<script src="./js/jquery.blockUI.2.23.js" type="text/javascript"></script>


<style type="text/css">
	.current_page_style
	{
		color:red;
		font-weight:bold;
	}
	
</style>

<script language="JavaScript">

	function view_approve_remark(payment_id)
	{
		$.blockUI({    //款式图
		  message: $('#approve_remark_'+payment_id), css: { 
		  top:  ($(window).height()) /2 + 'px', 
		  left: ($(window).width()-500) /2 + 'px'
		  }
		});	
	}
	
	$(document).ready(function(){
		
		$("img[id^='img_submit_approve_']").click(function(){
			$.unblockUI();
		});

		$("img[id^='img_close_approve_remark_']").click(function(){
			$.unblockUI();
		});		
		
	});
	
	function post_to_approve(payment_id)
	{
	if(confirm('{$lang.erp_payment_sure_to_post_to_approve}'))
	{
		Ajax.call('erp_payment.php?act=post_to_approve', 'payment_id='+payment_id, postToApprove, 'POST', 'JSON');
	}
	function postToApprove(res)
	{
		if(res.error!=0)
		{
			alert(res.message);
		}
		else{
			alert(res.message);
			window.document.location="./erp_payment_manage.php?act=payment_list";
		}
	}
}
	
</script>

{foreach from=$payment_info item=payment}
{if $payment.payment_status eq 3 or $payment.payment_status eq 4}

<div class="approve_remark" id="approve_remark_{$payment.payment_id}">
<div class="approve_remark_head">
	<table cellpadding="0" cellspacing="0" bpayment='0'>
		<tr>
			<td>
				<img src="./images/approve_remark.gif" />
			</td>
			<td align="right">
				<span><img style="cursor:pointer;" id="img_close_approve_remark_{$payment.payment_id}" src="./images/close.gif" /></span>
			</td>
		</tr>
	</table>
</div>

<div class="approve_remark_box">
<table  cellpadding="5" cellspacing="0" bpayment='0'>
	 <tr>
    	<td width="60">{$lang.erp_approve_remark}</td>	
		<td>
			<textarea rows="8" cols="55" disabled="true" id="textarea_approve_remark_{$payment.payment_id}">{$payment.approve_remark}</textarea>
		</td>
	</tr>	
</table>
</div>
<div class="div_submit_approve">
	<img style="cursor:pointer;" id="img_submit_approve_{$payment.payment_id}" src="./images/submit.gif" />
</div>	
</div>

{/if}
{/foreach}


<!-- start payment info -->
 <div class="list-div" id="listDiv">
<table  cellpadding="3" cellspacing="1">
  <tr>
    <th width="5%">{$lang.erp_payment_id}</th>
    <th width="8%">{$lang.erp_payment_sn}</th>
 	<th>{$lang.erp_payment_remark}</th>
	<th width="10%">{$lang.erp_payment_pay_to}</th>
	<th width="8%">{$lang.erp_payment_date}</th>
	<th>{$lang.erp_operation}</th>
  <tr>
  <tr id="tr_{$payment_info.payment_id}">
    <td>{$payment_info.payment_id}</td>
	<td align="center">{$payment_info.payment_sn}</td>	
	<td>{$payment_info.payment_remark}</td>	
	<td >{$payment_info.factory_info.name}</td>
	<td  align="center">{$payment_info.payment_date}</td>
		
	<td align="center"  width="20%">
		{if $payment_info.available_act.edit eq 1}<a href="erp_finance_manage.php?act=edit_payment&payment_id={$payment_info.payment_id}">{$lang.erp_operation_edit}</a>{/if}
		{if $payment_info.available_act.delete eq 1}<a href="javascript:delete_payment({$payment_info.payment_id})">{$lang.erp_operation_delete}</a>{/if}
		
		{if $payment_info.available_act.post_to_approve eq 1}<a href="javascript:post_to_approve({$payment_info.payment_id})">{$lang.erp_operation_post_to_approve}</a>{/if}
		{if $payment_info.available_act.approve eq 1}
			<a href="erp_finance_manage.php?act=approve_payment&payment_id={$payment_info.payment_id}">{$lang.erp_operation_approve}</a>
		{/if}	
		{if $payment_info.payment_status eq 3 or $payment_info.payment_status eq 4}
			<a href="erp_finance_manage.php?act=view_payment&payment_id={$payment_info.payment_id}">{$lang.erp_operation_view}</a>
			<a href="javascript:view_approve_remark({$payment_info.payment_id})">{$lang.erp_payment_operation_view_approve_remark}</a>
		{/if}
		
		{if $payment_info.payment_status eq 3}
			<a target="_blank" href="erp_finance_manage.php?act=print_payment&payment_id={$payment_info.payment_id}&page=1">{$lang.erp_operation_print}</a>
		{/if}
    </td>				
  </tr>
</table>
</div>
<!-- end payment info -->

<style type="text/css">
	#outside_container
	{
		width:100%;
		border:none;
		overflow:hidden;
		text-align:center;
		padding:10px;
		background-color:#F4FAFB;
	}
	#inner_container
	{
		width:45%;
		border:1px solid #DDD;
		overflow:hidden;
		text-align:left;
		background-color:#DDEEF2;
	}

	
	#inner_container table tr td
	{
		padding:6px;
		font-weight:bold;
		background-color:#FFF;
	}
	
	.tb_lable
	{
		padding-left:20px;
		
	}

</style>

<div class="main-div">
	<div id="outside_container">
		<div id="inner_container">
				<table  cellpadding="5" cellspacing="0" bpayment='0'>
	 <tr>
    	<td width="130">{$lang.erp_payment_sn}</td>	
		<td>
			<span>{$payment.payment_sn}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_date}</td>	
		<td>
			<span>{$payment.payment_date}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_pay_to}</td>	
		<td>
			<span>{$payment.factory_info.name}</span>
		</td>
	</tr>	
	<tr>
    	<td>{$lang.erp_payment_order_id}</td>	
		<td>
			<span>{$payment.order_info.order_sn}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_order_date}</td>	
		<td>
			<span>{$payment.order_info.order_date}</span>
		</td>
	</tr>	
	<tr>
    	<td>{$lang.erp_payment_order_amount}</td>	
		<td>
			<span>{$payment.bill_amount}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_order_total_dues}</td>	
		<td>
			<span>{$payment.bill_total_dues}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_order_paid_dues}</td>	
		<td>
			<span>{$payment.bill_paid_dues}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_order_dues_balance}</td>	
		<td>
			<span>{$payment.bill_dues_balance}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_pay_amount}</td>	
		<td>
			<span>{$payment.pay_amount}</span>
		</td>
	</tr>
	<tr>
    	<td>{$lang.erp_payment_remark}</td>	
		<td>
			<textarea rows="4" cols="45" disabled="true" id="textarea_payment_remark_{$payment.payment_id}">{$payment.payment_remark}</textarea>
		</td>
	</tr>							
</table>
		</div>
	</div>
</div>




{literal}
<script language="JavaScript">

   	
		function post_to_rate(payment_id)
		{
			function postToRateResponse(res)
			{
				if(res.error!=0)
				{
					alert(res.message);
				}
				else{
					alert(res.message);
					window.document.location="./erp_payment_manage.php?act=payment_list";
				}
			}
			if(confirm('{$lang.erp_payment_sure_to_post_payment}'))
			{	
				Ajax.call('erp_payment.php?act=post_to_rate', 'payment_id=' + payment_id, postToRateResponse, 'POST', 'JSON');
			}
		}

		function delete_payment(payment_id)
		{
				function deletepaymentResponse(res)
				{
					if(res.error==4)
					{
						alert(res.message);
						window.document.location="./erp_payment_manage.php?act=payment_list";
					}
					else if(res.error==0)
					{
						alert(res.message);
						window.document.location="./erp_payment_manage.php?act=payment_list";
					}
					else{
						alert(res.message);
					}
				}
				
				if(confirm('{$lang.erp_payment_sure_to_delete_payment}'))
				{
					Ajax.call('erp_payment.php?act=delete_payment', 'payment_id=' + payment_id, deletepaymentResponse, 'POST', 'JSON');
				}
			}
	
 
</script>
{/literal}
{include file="pagefooter.htm"}

